package cn.zz.veggie.application.assembler;

import cn.zz.veggie.model.domain.Shop;
import cn.zz.veggie.model.enums.ShopStatus;
import cn.zz.veggie.model.query.ShopQuery;
import cn.zz.veggie.web.types.dto.mgmt.shop.MgmtShopQueryDto;
import cn.zz.veggie.web.types.dto.mgmt.shop.MgmtShopSaveDto;

/**
 * @author zhongq
 * @since 2024/7/28
 */
public class ShopAssembler {
	public static ShopQuery buildQuery(MgmtShopQueryDto dto) {
		final ShopQuery shopQuery = new ShopQuery();
		shopQuery.likeName = dto.getName();
		shopQuery.likeMobile = dto.getMobile();
		shopQuery.status = ShopStatus.active.status;
		return shopQuery;
	}

	public static Shop buildSaveDomain(MgmtShopSaveDto dto) {
		final Shop shop = new Shop();
		shop.setId(dto.getId());
		shop.setName(dto.getName());
		shop.setAddress(dto.getAddress());
		shop.setMobile(dto.getMobile());
		return shop;
	}


}